\(\int (a+i a \tan (e+f x))^m (c+d \tan (e+f x))^2 \, dx\) [1181]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [F]
   Fricas [F]
   Sympy [F]
   Maxima [F]
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 28, antiderivative size = 119 \[ \int (a+i a \tan (e+f x))^m (c+d \tan (e+f x))^2 \, dx=\frac {2 c d (a+i a \tan (e+f x))^m}{f m}-\frac {i (c-i d)^2 \operatorname {Hypergeometric2F1}\left (1,m,1+m,\frac {1}{2} (1+i \tan (e+f x))\right ) (a+i a \tan (e+f x))^m}{2 f m}-\frac {i d^2 (a+i a \tan (e+f x))^{1+m}}{a f (1+m)} \]

[Out]

2*c*d*(a+I*a*tan(f*x+e))^m/f/m-1/2*I*(c-I*d)^2*hypergeom([1, m],[1+m],1/2+1/2*I*tan(f*x+e))*(a+I*a*tan(f*x+e))
^m/f/m-I*d^2*(a+I*a*tan(f*x+e))^(1+m)/a/f/(1+m)

Rubi [A] (verified)

Time = 0.18 (sec) , antiderivative size = 119, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3624, 3608, 3562, 70} \[ \int (a+i a \tan (e+f x))^m (c+d \tan (e+f x))^2 \, dx=-\frac {i (c-i d)^2 (a+i a \tan (e+f x))^m \operatorname {Hypergeometric2F1}\left (1,m,m+1,\frac {1}{2} (i \tan (e+f x)+1)\right )}{2 f m}+\frac {2 c d (a+i a \tan (e+f x))^m}{f m}-\frac {i d^2 (a+i a \tan (e+f x))^{m+1}}{a f (m+1)} \]

[In]

Int[(a + I*a*Tan[e + f*x])^m*(c + d*Tan[e + f*x])^2,x]

[Out]

(2*c*d*(a + I*a*Tan[e + f*x])^m)/(f*m) - ((I/2)*(c - I*d)^2*Hypergeometric2F1[1, m, 1 + m, (1 + I*Tan[e + f*x]
)/2]*(a + I*a*Tan[e + f*x])^m)/(f*m) - (I*d^2*(a + I*a*Tan[e + f*x])^(1 + m))/(a*f*(1 + m))

Rule 70

Int[((a_) + (b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[(b*c - a*d)^n*((a + b*x)^(m + 1)/(b^(
n + 1)*(m + 1)))*Hypergeometric2F1[-n, m + 1, m + 2, (-d)*((a + b*x)/(b*c - a*d))], x] /; FreeQ[{a, b, c, d, m
}, x] && NeQ[b*c - a*d, 0] &&  !IntegerQ[m] && IntegerQ[n]

Rule 3562

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Dist[-b/d, Subst[Int[(a + x)^(n - 1)/(a - x), x]
, x, b*Tan[c + d*x]], x] /; FreeQ[{a, b, c, d, n}, x] && EqQ[a^2 + b^2, 0]

Rule 3608

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[d*(
(a + b*Tan[e + f*x])^m/(f*m)), x] + Dist[(b*c + a*d)/b, Int[(a + b*Tan[e + f*x])^m, x], x] /; FreeQ[{a, b, c,
d, e, f, m}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] &&  !LtQ[m, 0]

Rule 3624

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Simp[
d^2*((a + b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1))), x] + Int[(a + b*Tan[e + f*x])^m*Simp[c^2 - d^2 + 2*c*d*Tan[e
 + f*x], x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[b*c - a*d, 0] &&  !LeQ[m, -1] &&  !(EqQ[m, 2] && EqQ
[a, 0])

Rubi steps \begin{align*} \text {integral}& = -\frac {i d^2 (a+i a \tan (e+f x))^{1+m}}{a f (1+m)}+\int (a+i a \tan (e+f x))^m \left (c^2-d^2+2 c d \tan (e+f x)\right ) \, dx \\ & = \frac {2 c d (a+i a \tan (e+f x))^m}{f m}-\frac {i d^2 (a+i a \tan (e+f x))^{1+m}}{a f (1+m)}+(c-i d)^2 \int (a+i a \tan (e+f x))^m \, dx \\ & = \frac {2 c d (a+i a \tan (e+f x))^m}{f m}-\frac {i d^2 (a+i a \tan (e+f x))^{1+m}}{a f (1+m)}-\frac {\left (i a (c-i d)^2\right ) \text {Subst}\left (\int \frac {(a+x)^{-1+m}}{a-x} \, dx,x,i a \tan (e+f x)\right )}{f} \\ & = \frac {2 c d (a+i a \tan (e+f x))^m}{f m}-\frac {i (c-i d)^2 \operatorname {Hypergeometric2F1}\left (1,m,1+m,\frac {1}{2} (1+i \tan (e+f x))\right ) (a+i a \tan (e+f x))^m}{2 f m}-\frac {i d^2 (a+i a \tan (e+f x))^{1+m}}{a f (1+m)} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.79 (sec) , antiderivative size = 94, normalized size of antiderivative = 0.79 \[ \int (a+i a \tan (e+f x))^m (c+d \tan (e+f x))^2 \, dx=\frac {(a+i a \tan (e+f x))^m \left (-i (c-i d)^2 (1+m) \operatorname {Hypergeometric2F1}\left (1,m,1+m,\frac {1}{2} (1+i \tan (e+f x))\right )+2 d (-i d m+2 c (1+m)+d m \tan (e+f x))\right )}{2 f m (1+m)} \]

[In]

Integrate[(a + I*a*Tan[e + f*x])^m*(c + d*Tan[e + f*x])^2,x]

[Out]

((a + I*a*Tan[e + f*x])^m*((-I)*(c - I*d)^2*(1 + m)*Hypergeometric2F1[1, m, 1 + m, (1 + I*Tan[e + f*x])/2] + 2
*d*((-I)*d*m + 2*c*(1 + m) + d*m*Tan[e + f*x])))/(2*f*m*(1 + m))

Maple [F]

\[\int \left (a +i a \tan \left (f x +e \right )\right )^{m} \left (c +d \tan \left (f x +e \right )\right )^{2}d x\]

[In]

int((a+I*a*tan(f*x+e))^m*(c+d*tan(f*x+e))^2,x)

[Out]

int((a+I*a*tan(f*x+e))^m*(c+d*tan(f*x+e))^2,x)

Fricas [F]

\[ \int (a+i a \tan (e+f x))^m (c+d \tan (e+f x))^2 \, dx=\int { {\left (d \tan \left (f x + e\right ) + c\right )}^{2} {\left (i \, a \tan \left (f x + e\right ) + a\right )}^{m} \,d x } \]

[In]

integrate((a+I*a*tan(f*x+e))^m*(c+d*tan(f*x+e))^2,x, algorithm="fricas")

[Out]

integral((c^2 + 2*I*c*d - d^2 + (c^2 - 2*I*c*d - d^2)*e^(4*I*f*x + 4*I*e) + 2*(c^2 + d^2)*e^(2*I*f*x + 2*I*e))
*(2*a*e^(2*I*f*x + 2*I*e)/(e^(2*I*f*x + 2*I*e) + 1))^m/(e^(4*I*f*x + 4*I*e) + 2*e^(2*I*f*x + 2*I*e) + 1), x)

Sympy [F]

\[ \int (a+i a \tan (e+f x))^m (c+d \tan (e+f x))^2 \, dx=\int \left (i a \left (\tan {\left (e + f x \right )} - i\right )\right )^{m} \left (c + d \tan {\left (e + f x \right )}\right )^{2}\, dx \]

[In]

integrate((a+I*a*tan(f*x+e))**m*(c+d*tan(f*x+e))**2,x)

[Out]

Integral((I*a*(tan(e + f*x) - I))**m*(c + d*tan(e + f*x))**2, x)

Maxima [F]

\[ \int (a+i a \tan (e+f x))^m (c+d \tan (e+f x))^2 \, dx=\int { {\left (d \tan \left (f x + e\right ) + c\right )}^{2} {\left (i \, a \tan \left (f x + e\right ) + a\right )}^{m} \,d x } \]

[In]

integrate((a+I*a*tan(f*x+e))^m*(c+d*tan(f*x+e))^2,x, algorithm="maxima")

[Out]

integrate((d*tan(f*x + e) + c)^2*(I*a*tan(f*x + e) + a)^m, x)

Giac [F]

\[ \int (a+i a \tan (e+f x))^m (c+d \tan (e+f x))^2 \, dx=\int { {\left (d \tan \left (f x + e\right ) + c\right )}^{2} {\left (i \, a \tan \left (f x + e\right ) + a\right )}^{m} \,d x } \]

[In]

integrate((a+I*a*tan(f*x+e))^m*(c+d*tan(f*x+e))^2,x, algorithm="giac")

[Out]

integrate((d*tan(f*x + e) + c)^2*(I*a*tan(f*x + e) + a)^m, x)

Mupad [F(-1)]

Timed out. \[ \int (a+i a \tan (e+f x))^m (c+d \tan (e+f x))^2 \, dx=\int {\left (a+a\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}^m\,{\left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )}^2 \,d x \]

[In]

int((a + a*tan(e + f*x)*1i)^m*(c + d*tan(e + f*x))^2,x)

[Out]

int((a + a*tan(e + f*x)*1i)^m*(c + d*tan(e + f*x))^2, x)